package com.dayaokeji.rhythmschoolstudent.client.home.helper


import android.os.Bundle
import android.support.v4.app.Fragment
import android.text.Html
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup

import com.dayaokeji.rhythmschoolstudent.R
import com.dayaokeji.rhythmschoolstudent.client.common.base.ActivityTemplateMethod
import kotlinx.android.synthetic.main.fragment_helper_step_one.*


/**
 * @author feiwo
 *
 * course sign failed helper step 4
 *
 */
class HelperStepFourFragment : Fragment(), ActivityTemplateMethod {


    companion object {
        fun newInstance() = HelperStepFourFragment()
    }

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
                              savedInstanceState: Bundle?): View? {
        return inflater.inflate(R.layout.fragment_helper_step_one, container, false)
    }

    override fun onActivityCreated(savedInstanceState: Bundle?) {
        super.onActivityCreated(savedInstanceState)
        init()
        setOnListener()
    }

    override fun setupView() {
        btnLeft.text = "大家都签到失败"
        btnRight.text = "好吧"
    }

    override fun setupViewData() {
        val helperStr = "4.由于机型问题无法一键签到，请打开移动数据通过扫描附近已签到同学的二维码进行签到。<br/><br/>课后请联系运维人员QQ：3394055292";

        tvHelperTips.text = Html.fromHtml(helperStr)
    }

    private fun setOnListener() {
        btnLeft.setOnClickListener {
            activity?.let {
                if (it is CourseSignFailedHelperActivity) {
                    it.nextPage()
                }
            }
        }

        btnRight.setOnClickListener {
            activity?.finish()
        }
    }
}
